//
// Created by Asus on 2025/6/2.
//

#include <iostream>
#include <vector>
using namespace std;

void printVector(vector<int>& v) {
    for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
        cout << *it << " ";
    }
    cout << endl;
}

void demo01() {
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(3);
    v.push_back(4);
    printVector(v);
    // 尾删
    v.pop_back();
    printVector(v);

    v.insert(v.begin(), 5);
    printVector(v);

    v.erase(v.begin()+1, v.end());
    printVector(v);

    v.clear();
    printVector(v);

    v.emplace_back(5);
    v.emplace_back(6);
    printVector(v);

    cout << v.capacity() << endl;
}

int main(int argc, char *argv[]) {
    demo01();
    return 0;
}
